Skip to content

feat(web): filter sidebar threads by environment - #8530

Open
saphid wants to merge 1 commit into
pingdotgg:mainfrom
saphid:web/sidebar-environment-filter
Open

feat(web): filter sidebar threads by environment#8530
saphid wants to merge 1 commit into
pingdotgg:mainfrom
saphid:web/sidebar-environment-filter

Conversation

@saphid

@saphid saphid commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

With several environments connected, the sidebar mixes every environment's threads, and nothing narrows the list to one machine.

This adds an Environments menu beside the sidebar project picker. It only appears when more than one environment is connected. You pick which environments contribute threads, or choose All environments to restore everything. At least one environment always stays selected: the last one is locked in the menu, with a tooltip saying why. The project and environment filters combine. Pinned rows, active rows, settled rows, and drafts all use the same selection. The project picker only offers projects that exist in an enabled environment, and a dot on the trigger shows a filter is on. The filter lasts for the session only. Environments that disconnect are dropped from it during render, so the list can never show an empty frame. docs/user/thread-sidebar.md now explains both filters and how to clear each one, as Theo's carryover note asked.

The branch is one commit rebased onto current main (211618fd9f). Nothing on main or in other PRs already does this. The environment-pruning sync is a render-time state adjustment, so no set-state-in-effect lint warning.

Verification

  • vp test run apps/web/src/components/Sidebar.logic.test.ts: 168 passed
  • apps/web typecheck: no errors in the touched files (main currently has 23 pre-existing errors in the unrelated markdown-incremental/HighlightedCodeLines perf commits)
  • vp lint on the touched files: 0 errors, warnings only on pre-existing intentional patterns
  • vp fmt --check on the touched files passes

Real client proof

These captures compare base e3b644c5af with the previous head 5a9505325, whose UI matches this head exactly. They were taken in the full web client at 1280×800 with two real disposable servers paired through the normal UI.

Before:

Before: six threads across two environments

After:

After: one environment, then all six threads restored

Before clean video · After clean video · After annotated video

Not covered at runtime: Electron, relay/tunnel, and disconnected-environment journeys. Focused logic tests cover composition, pruning, and the last-enabled guard. Mobile has its own thread list and is outside this change.

Originally implemented with GPT-6 in Codex; rebased and modernized with Claude Opus 5 in Claude Code (T3 Code); rebased onto 211618fd9f and re-verified with Devin (SWE-2 Medium, Cursor harness). The cross-provider GPT-6 Astra review was skipped because the Codex weekly usage limit was reached.

Coordination trace: T3 thread 8f36d80e-338d-4f7c-8770-3dc2adcc6744

Summary by CodeRabbit

  • New Features

    • Added an Environments filter to the thread sidebar when multiple environments are connected.
    • Filter threads, drafts, and project entries by selected environments.
    • At least one environment remains selected, while unavailable environments are removed automatically.
    • Project scope and thread selection adjust when filtering changes, with a dedicated empty state when no results remain.
  • Documentation

    • Added guidance for combining project and environment filters and restoring the full thread list.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 358c6c2d-377f-447c-822d-ea830f95cff0

📥 Commits

Reviewing files that changed from the base of the PR and between abf6424 and 02c5cb5.

📒 Files selected for processing (1)
  • apps/web/src/components/Sidebar.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The sidebar adds a session-only environment filter. It hides matching threads, drafts, and project entries, maintains valid selections as environments connect or disconnect, and documents the new controls.

Changes

Sidebar environment filtering

Layer / File(s) Summary
Environment filter logic and tests
apps/web/src/components/Sidebar.logic.ts, apps/web/src/components/Sidebar.logic.test.ts
Adds helpers to toggle disabled environments, preserve one enabled environment, prune disconnected ids, and reset invalid filters. Tests cover these behaviors and same-instance returns.
Sidebar filter state and row filtering
apps/web/src/components/Sidebar.tsx
Tracks pruned filter state, updates project scope, filters drafts and threads, clears hidden selections, and resets settled-tail pagination.
Environment filter menu and documentation
apps/web/src/components/Sidebar.tsx, docs/user/thread-sidebar.md
Adds the environment menu, last-environment protection, filtered empty state, and documentation for combined project and environment filters.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant EnvironmentMenu
  participant Sidebar
  participant ThreadList
  participant DraftRows
  User->>EnvironmentMenu: Toggle an environment
  EnvironmentMenu->>Sidebar: Update disabled environment ids
  Sidebar->>ThreadList: Recompute visible threads
  Sidebar->>DraftRows: Recompute visible drafts
  ThreadList-->>User: Show enabled-environment threads
  DraftRows-->>User: Show enabled-environment drafts
Loading

Suggested reviewers: juliusmarminge, t3dotgg, maria-rcks

Merge Risk: ⚪ Minimal · up to 8c4fd

The sidebar filter consistently applies to threads, drafts, and project choices while preserving a valid enabled-environment selection.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the primary change: adding environment-based filtering to sidebar threads.
Description check ✅ Passed The description thoroughly explains what changed, why it changed, UI behavior, verification results, and UI evidence. It does not reproduce the template headings or checklist, but it provides the requ…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 28, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR adds a new environment-filtering interaction to the sidebar and integrates it with thread, draft, project-scope, selection, and empty-state behavior. The feature is production-facing and has enough stateful UI surface to warrant human review.

No code changes detected at 8c4fd21. Prior analysis still applies.

You can add or adjust custom eligibility rules. Learn more.

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Aug 28, 2026
@saphid
saphid force-pushed the web/sidebar-environment-filter branch from 258c853 to 8983e13 Compare August 28, 2026 21:35
@macroscopeapp
macroscopeapp Bot dismissed their stale review August 28, 2026 21:35

Dismissing prior approval to re-evaluate 8983e13

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One consistency finding on the new environment-filter trigger: it is the only icon SidebarMenuButton in this header row without the coarse-pointer hit-target overlay its neighbors use. Everything else (Menu/MenuPopup/MenuCheckboxItem composition, width-class contract on MenuPopup, active-filter dot matching PullRequestListFilters) matches the shared component system.

Posted via Macroscope — UI Consistency

Comment thread apps/web/src/components/Sidebar.tsx Outdated
Comment thread apps/web/src/components/Sidebar.tsx Outdated
@saphid
saphid force-pushed the web/sidebar-environment-filter branch 2 times, most recently from 14ed67b to 72c948d Compare August 29, 2026 03:48

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two consistency findings on the new environment filter control in apps/web/src/components/Sidebar.tsx. Everything else (dot indicator matching PullRequestListFilters, MenuPopup width contract, SidebarMenuButton icon-color indirection) lines up with the existing system.

Posted via Macroscope — UI Consistency

Comment thread apps/web/src/components/Sidebar.tsx Outdated
Comment thread apps/web/src/components/Sidebar.tsx Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d80e30b. Configure here.

Comment thread apps/web/src/components/Sidebar.logic.ts Outdated

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One finding on the new commit: the locked environment row explains its constraint with a native title attribute instead of the shared Tooltip primitive. Details inline.

Posted via Macroscope — UI Consistency

Comment thread apps/web/src/components/Sidebar.tsx Outdated

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One finding on the newest commit: the environment checkbox rows now pin data-highlighted text colors, which overrides MenuCheckboxItem's accent-surface foreground contract.

Posted via Macroscope — UI Consistency

Comment thread apps/web/src/components/Sidebar.tsx Outdated
Comment thread apps/web/src/components/Sidebar.tsx Outdated
@t3dotgg

t3dotgg commented Sep 4, 2026

Copy link
Copy Markdown
Member

Note

🤖 GPT-6 Astra (preview) responding on behalf of Theo

This note is part of an automated cleanup pass.

Documentation carryover from #9241 at 32c1c96: update docs/user/thread-sidebar.md to explain that web and desktop can filter by project and environment, and explain how to clear each filter. Adapt the text to this PR's retained combobox and environment controls. Do not copy the alternative's Project/Environment submenu instructions. This records documentation work for follow-up and does not claim the text has been added.

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Sep 7, 2026
@cursor

cursor Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@saphid
saphid force-pushed the web/sidebar-environment-filter branch from 5a95053 to abf6424 Compare September 11, 2026 02:37
@macroscopeapp
macroscopeapp Bot dismissed their stale review September 11, 2026 02:37

Dismissing prior approval to re-evaluate abf6424

@saphid

saphid commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Docs carryover from #9241 is addressed in abf6424: docs/user/thread-sidebar.md now has a Filter the thread list section. It covers the project picker (clear it with All projects), the Environments menu (clear it with All environments; at least one environment stays selected), and how the two filters combine. It describes this PR's combobox and environment menu, not the Project/Environment submenu from #9241.

@saphid
saphid force-pushed the web/sidebar-environment-filter branch from abf6424 to 02c5cb5 Compare September 11, 2026 12:24
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@saphid
saphid force-pushed the web/sidebar-environment-filter branch from 02c5cb5 to 8c4fd21 Compare September 11, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants